from .models import *
from rest_framework import serializers


class StationStatusSerializer(serializers.ModelSerializer):
    class Meta:
        model = StationStatus
        fields = [
            "start_time",
            "end_time",
            "during_time",
            "point_id",
            "during_time1",
            "sub_area",
            "equipment_id",
            "shift",
            "call_type",
        ]


class AndonCallSerializer(serializers.ModelSerializer):
    class Meta:
        model = AndonCall
        fields = [
            "start_time",
            "end_time",
            "during_time",
            "point_id",
            "during_time1",
            "sub_area",
            "equipment_id",
            "shift",
            "call_type",
        ]


class MachineFaultHistorySerializer(serializers.ModelSerializer):
    class Meta:
        model = MachineFaultHistory
        fields = [
            "start_time",
            "end_time",
            "during_time",
            "point_id",
            "during_time1",
            "sub_area",
            "equipment_id",
            "shift",
            "call_type",
        ]


class AndonPullCallsSerializer(serializers.ModelSerializer):
    class Meta:
        model = AndonPullCalls
        fields = [
            "start_time",
            "end_time",
            "during_time",
            "point_id",
            "during_time1",
            "sub_area",
            "equipment_id",
            "shift",
            "call_type",
        ]


class EquipmentSerializer(serializers.ModelSerializer):
    class Meta:
        model = Equipment
        fields = [
            "point_id",
            "sub_area",
            "line",
            "equipment_id",
        ]


class Top20ShutdownSerializer(serializers.ModelSerializer):
    class Meta:
        model = Top20Shutdown
        fields = [
            "id",
            "start_time",
            "end_time",
            "during_time",
            "point_id",
            "during_time1",
            "sub_area",
            "equipment_id",
            "shift",
            "call_type",
        ]


class LastCtStatisticsSerializer(serializers.ModelSerializer):
    class Meta:
        model = LastCtStatistics
        fields = [
            "production_date",
            "shift",
            "hour",
            "point_id",
            "sub_area",
            "equipment_id",
            "cycletime",
        ]


class production_totalSerializer(serializers.ModelSerializer):
    class Meta:
        model = ProductionTotal
        fields = [
            "production_date",
            "shift",
            "point_id",
            "hour_1",
            "hour_2",
            "hour_3",
            "hour_4",
            "hour_5",
            "hour_6",
            "hour_7",
            "hour_8",
            "hour_9",
            "hour_10",
            "hour_11",
            "hour_12",
            "sum",
        ]


class MachineFaultHistorySerializer(serializers.ModelSerializer):
    class Meta:
        model = MachineFaultHistory
        fields = [
            "start_time",
            "end_time",
            "during_time",
            "point_id",
            "during_time1",
            "sub_area",
            "equipment_id",
            "shift",
            "call_type",
        ]


class ProductionHourlySerializer(serializers.ModelSerializer):
    class Meta:
        model = ProductionHourly
        fields = [
            "production_date",
            "point_id",
            "shift",
            "hour_1",
            "hour_2",
            "hour_3",
            "hour_4",
            "hour_5",
            "hour_6",
            "hour_7",
            "hour_8",
            "hour_9",
            "hour_10",
            "hour_11",
            "hour_12",
            "sum",
        ]


class ScheduleSerializer(serializers.ModelSerializer):
    class Meta:
        model = Schedule
        fields = [
            "sub_area",
            "production_date",
            "shift",
            "shift_start_time",
            "shift_end_time",
        ]


class ToolChangeLogSerializer(serializers.ModelSerializer):
    class Meta:
        model = ToolChangeLog
        fields = ["create_date", "project", "sub_area", "equipment", "serial_number", "shift"]


class MsCycleDataSerializer(serializers.ModelSerializer):
    class Meta:
        model = MsCycleData
        fields = ["id", "station", "equipment_target_time", "push_pull_target_time"]
